package homework.rm;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class FtpServer {

	public static void main(String[] args) throws Exception {		
		ServerSocket server=new ServerSocket(8001);
		while(true){
		Socket socket=server.accept();
		OutputStream out=socket.getOutputStream();
		InputStream in=socket.getInputStream();
		BufferedReader reader=new BufferedReader(new InputStreamReader(in));
		
		String filename=reader.readLine();      //根据接收的路径找到文件
		
		File file=new File(filename);
		if (file.delete()) {
			out.write("finished\n".getBytes());
		}
		
		
		

		
		
		reader.close();
		out.close();
		socket.close();
		
	
	}}

}
